Okay.
So in today's lesson we're going to have a look at proximity prompts.
This will be a quick lesson talking about how proximity prompts work and how to set them up okay.
Um, these this lesson as well as the previous lesson on dialogue.
Okay.
Um, we just looked at setting them up and they most become useful when you start scripting them.
So we will have a look at how to script dialogue and proximity prompts.
In the next section we look at the advanced scripting topics.
Um, so for now we're just having a look at how to set them up, and we will eventually look later on
how to script them, but how to.
Both mentioned.
Both of them are just some simple events that you can use by referencing the object.
So by referencing the proximity prompt and getting an event, or referencing the dialogue and getting
an event from there, so they're not too difficult to code, but we will go over them in a future lesson.
Okay, cool.
So I'm going to use the model of myself I got from last time.
Okay.
And inside of the head I'm going to add in a proximity prompt.
And this is one object this time.
And the proximity prompt is a really easy way for the players to be able to interact with your game.
Okay.
So we're just going to talk through some of the properties and see how it works.
So these are the default properties.
Let's see what it looks like with the default properties.
So let's click play.
And I don't think it will work with the default properties.
No.
The only property we need to change here is requires line of sight.
This means that this prompt that appears on your screen, it can only work if it has line of sight with
the player.
And because this is inside the head, the head mesh object is blocking it so it's not able to get line
of sight.
Line of sight is basically just being able to see it with your eyes.
So for example, you can't have line of sight of your computer screen because you're watching this video.
But if you turn around 180 degrees, you no longer have line of sight of it.
That's kind of how it works.
Okay, so to click that off and let's try again one more time and I'm confident this time it will work.
Let's go over.
Yep.
Nice.
So this is what happens.
We go over to it and once we're in activation distance a little prompt comes up here basically telling
us to interact with it.
We need to use the key it tells us there on the left hand side so we can hold down E or just press E,
and it will do it for us.
Okay.
That will then fire an event which you can then get to run whatever code you like.
So it's a really easy way to get the player to be using their keyboard and things like that.
Okay, so let's have a look at some of the properties of these.
So first you have action text.
That's for text that's basically going to display.
So you could call this interact or you could call this activate open close um enable all that other
kind of stuff.
Let's call this um.
Um, interact.
Maybe not for an NPC, maybe start quest.
For example.
Okay.
Um, clickable prompt, whether you can click it or not.
Obviously we want that and enabled obviously want that on as well.
Uh, let's go down a little bit.
Um, gamepad keycode and keyboard keycode.
These are two methods to use this.
Now, you've got to remember that, um, on roadblocks can always be played on Xbox devices.
Okay, so you also need to use gamepads.
Um, so like button x button L1 L2 for from Xbox.
So if you are interested on putting your game onto Xbox, you need to make sure you've got, um, you
can a player can use the gamepad Keycode as well as the normal keycodes.
Okay, so is the default, but you can change this to whatever you'd like.
There's all these different options here.
So if I was to choose, um, I don't know.
Let's say Q to start, um, a Q to start request, for example.
Okay.
Max activation distance is the number of studs away that you'll be able to activate this.
So I think ten would look quite nice.
So I'm staying with that.
The name obviously is just default properties there.
Um object text.
You can put some text on here as well.
Um, so let's say for example we could say um, start the volcano.
Quest.
Like that, they're okay.
For example okay style.
You've got you can add on a custom style if you wanted to, but we're not necessarily going to look
at that too much.
And finally we have offset.
That's if you wanted to offset where the proximity point is slightly.
We'll have a look at how that affects it in a minute.
So have a look how our properties have changed this.
Scurry over to it and see it says start the Volcano quest.
It says Start Quest.
Let's press Q and it then works nicely like that.
Also, we can change the whole duration down, so you have to hold the button down instead of just pressing
it.
So change this to say two seconds for example.
And then you have to hold down that button for two seconds in order for it to open.
So go over to it.
Hold down Q.
And then it fires like that.
Okay.
Um, the offset basically will move this up and down.
So it's kind of covering the NPC here.
So we might want to move it upwards a little bit, which is completely fine.
We can go to the offset, go to the Y and change this to say two for example and see how that looks.
Um, might be a bit too high or not high enough.
I'm not exactly sure.
Okay.
Hasn't changed too much.
Then, um, let's change maybe to 20 and see how that looks.
Um.
Okay.
It's it is a bit higher, but not too much.
So, um.
Okay.
That's fine.
Um, I guess another way to do it as well.
Instead of putting it inside the player's head, you could put it in a separate object inside of his
NPC, which kind of contains this.
Okay.
Um, but yeah, that's pretty much it.
Do you need to know about the proximity prompts?
Very, very nice.
Simple addition, like with dialogue, but just brings extra life into your game.
Okay.
Contains the same negatives as dialogue because it's very easy to use.
Lots of people use it.
So your game might lack its own original theme if you do choose to use it.
Okay.
So just think about before you do use this.
And again we will have a look at how to script fees in a future lesson.
But again, if you want to jump ahead a little bit and try out how to script fees, I'll tell you it's
just you reference the object and then you get a certain event from it and then go from there.
So if you do want to try it out, feel free.
But if not, that's completely fine and join me for the next lesson.
We're going to have a look at adornments.